﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>

    <h1 id="dateTimeConverter">ConcatenationConverter</h1>
<p>Concatenation converter concatenate a string property of all elements in a collection during data binding using specified separator between each value. The converter can concatenate property of elements within nested collections. Separator and nested levels are specified using a ConcatenationParameter object and passed as ConverterParameter duding binding.</p>
<p><strong>Namespace </strong></p>
<p><code>StoreAppLib.Converters</code></p>
<p><strong>Using ConcatenationConverter</strong></p>
<p>To use ConcatenationConverter in your project, add the reference to StoreAppLib project or install StoreAppLib from Visual Studio &quot;Manage NuGet Packages&quot; tool.</p>
<p>To use the converter while binding first declare the converter and concatenation parameter in the App.xaml file.</p>
<p><code><span style="color: blue; font-size: 9.5pt;" lang="EN">&lt;</span><span style="color: #a31515; font-size: 9.5pt;" lang="EN">Application<br /></span><span style="color: black; font-size: 9.5pt;" lang="EN">&nbsp;&nbsp; </span><span style="color: red; font-size: 9.5pt;" lang="EN"><strong>xmlns</strong></span><strong><span style="color: blue; font-size: 9.5pt;" lang="EN">:</span></strong><strong><span style="color: red; font-size: 9.5pt;" lang="EN">storeApp</span></strong><strong><span style="color: red; font-size: 9.5pt;">Converter</span></strong><strong><span style="color: blue; font-size: 9.5pt;" lang="EN">="using:StoreAppLib.Converters"</span></strong><span style="color: blue; font-size: 9.5pt;" lang="EN"><br /></span><span style="color: blue; font-size: 9.5pt;">&nbsp;&nbsp; ...</span><span style="color: black; font-size: 9.5pt;"> </span><span style="color: blue; font-size: 9.5pt;" lang="EN">&gt;<br /></span><span style="color: black; font-size: 9.5pt;" lang="EN">&nbsp;&nbsp; </span><span style="color: blue; font-size: 9.5pt;" lang="EN">&lt;</span><span style="color: #a31515; font-size: 9.5pt;" lang="EN">Application.Resources</span><span style="color: blue; font-size: 9.5pt;" lang="EN">&gt;<br /></span><span style="color: black; font-size: 9.5pt;" lang="EN">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: blue; font-size: 9.5pt;" lang="EN">&lt;</span><span style="color: #a31515; font-size: 9.5pt;" lang="EN">ResourceDictionary</span><span style="color: blue; font-size: 9.5pt;" lang="EN">&gt;</span></code></p>
<p><code><strong><span style="color: black; font-size: 9.5pt;" lang="EN">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></strong><strong><span style="color: blue; font-size: 9.5pt;" lang="EN">&lt;</span></strong><strong><span style="color: red; font-size: 9.5pt;" lang="EN">storeApp</span></strong><strong><span style="color: red; font-size: 9.5pt;">Converter</span></strong><strong><span style="color: blue; font-size: 9.5pt;" lang="EN">:</span></strong><strong><span style="color: #a31515; font-size: 9.5pt;" lang="EN">ConcatenationConverter <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></strong><strong><span style="color: red; font-size: 9.5pt;" lang="EN">x</span></strong><strong><span style="color: blue; font-size: 9.5pt;" lang="EN">:</span></strong><strong><span style="color: red; font-size: 9.5pt;" lang="EN">Key</span></strong><strong><span style="color: blue; font-size: 9.5pt;" lang="EN">="ConcatenationConverter" /&gt;</span></strong><strong><span style="color: black; font-size: 9.5pt;" lang="EN">&nbsp;&nbsp;&nbsp;<br /></span></strong></code><code><strong><span style="color: black; font-size: 9.5pt;" lang="EN"><br /></span></strong></code><code><strong><span style="color: black; font-size: 9.5pt;" lang="EN">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></strong><strong><span style="color: blue; font-size: 9.5pt;" lang="EN">&lt;</span></strong><strong><span style="color: red; font-size: 9.5pt;" lang="EN">storeApp</span></strong><strong><span style="color: red; font-size: 9.5pt;">Converter</span></strong><strong><span style="color: blue; font-size: 9.5pt;" lang="EN">:</span></strong><strong><span style="color: #a31515; font-size: 9.5pt;" lang="EN">ConcatenationParameter</span></strong><strong><span style="color: red; font-size: 9.5pt;" lang="EN"> <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></strong></code><code><strong><span style="color: red; font-size: 9.5pt;" lang="EN">x</span></strong><strong><span style="color: blue; font-size: 9.5pt;" lang="EN">:</span></strong><strong><span style="color: red; font-size: 9.5pt;" lang="EN">Key</span></strong><strong><span style="color: blue; font-size: 9.5pt;" lang="EN">="LanguageConcatenationParameter"<strong><span style="color: red; font-size: 9.5pt;" lang="EN">&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Property</span></strong><strong><span style="color: blue; font-size: 9.5pt;" lang="EN">="Employees.Languages.Name"<strong><span style="color: red; font-size: 9.5pt;" lang="EN">&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Separator</span></strong><strong><span style="color: blue; font-size: 9.5pt;" lang="EN">=","<strong><span style="color: red; font-size: 9.5pt;" lang="EN">&nbsp;Distinct</span></strong><strong><span style="color: blue; font-size: 9.5pt;" lang="EN">="True"</span></strong></span></strong></span></strong> /&gt;</span></strong><strong><span style="color: black; font-size: 9.5pt;" lang="EN">&nbsp;&nbsp;&nbsp;</span></strong></code></p>
<p><code><strong><span style="color: black; font-size: 9.5pt;" lang="EN">&nbsp;</span></strong><span style="color: black; font-size: 9.5pt;" lang="EN">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: blue; font-size: 9.5pt;" lang="EN">&lt;/</span><span style="color: #a31515; font-size: 9.5pt;" lang="EN">ResourceDictionary</span><span style="color: blue; font-size: 9.5pt;" lang="EN">&gt;<br /></span><span style="color: black; font-size: 9.5pt;" lang="EN">&nbsp;&nbsp; </span><span style="color: blue; font-size: 9.5pt;" lang="EN">&lt;/</span><span style="color: #a31515; font-size: 9.5pt;" lang="EN">Application.Resources</span><span style="color: blue; font-size: 9.5pt;" lang="EN">&gt;<br />&lt;/</span><span style="color: #a31515; font-size: 9.5pt;" lang="EN">Application</span><span style="color: blue; font-size: 9.5pt;" lang="EN">&gt;</span></code></p>
<p>The concatenation parameter declaration in the above code can be used to concatenate languages of all employees in all departments. The ConcatenationConverter loop through each employee collection in each department, find the distinct languages and then concatenation them using comma separator.</p>
<p>Following code shows the usage of the converter while binding.<span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;"><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;">&nbsp;</span></span></p>
<p>&lt;<span style="font-size: 9.5pt; font-family: Consolas; color: #a31515;"><span style="font-size: 9.5pt; font-family: Consolas; color: #a31515;"><span style="font-size: 9.5pt; font-family: Consolas; color: #a31515;">TextBlock</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"> </span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;">Text</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;"><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;"><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;">="{</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #a31515;"><span style="font-size: 9.5pt; font-family: Consolas; color: #a31515;"><span style="font-size: 9.5pt; font-family: Consolas; color: #a31515;">Binding</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"> Company</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;"><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;"><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;">.Departments,</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"> <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Converter</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;"><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;"><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;">={</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #a31515;"><span style="font-size: 9.5pt; font-family: Consolas; color: #a31515;"><span style="font-size: 9.5pt; font-family: Consolas; color: #a31515;">StaticResource</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"> ConcatenationConverter</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;"><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;"><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;">},</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"> <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ConverterParameter</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;"><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;"><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;">={</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #a31515;"><span style="font-size: 9.5pt; font-family: Consolas; color: #a31515;"><span style="font-size: 9.5pt; font-family: Consolas; color: #a31515;">StaticResource</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"> LanguageConcatenationParameter</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;"><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;"><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;">}}"</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"> <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Style</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;"><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;"><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;">="{</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #a31515;"><span style="font-size: 9.5pt; font-family: Consolas; color: #a31515;"><span style="font-size: 9.5pt; font-family: Consolas; color: #a31515;">StaticResource</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"><span style="font-size: 9.5pt; font-family: Consolas; color: #ff0000;"> BasicTextStyle</span></span></span><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;"><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;"><span style="font-size: 9.5pt; font-family: Consolas; color: #0000ff;">}" /&gt;</span></span></span></p>

</body>
</html>
